Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSOE-179: Migrate to .editorconfig from ruleset files #93

Merged
merged 60 commits into from
Oct 16, 2023
Merged

Conversation

Piedone
Copy link
Member

@Piedone Piedone commented Oct 10, 2023

Fixes #32
OSOE-179

Release notes, to be copied to the GitHub release:

TL;DR upgrade instructions

If you used Lombiq .NET Analyzers in an Orchard Core app without overriding any of its configuration, then you have to change its package reference like this:

-<PackageReference Include="Lombiq.Analyzers" Version="x.y.z">
+<PackageReference Include="Lombiq.Analyzers.OrchardCore" Version="4.0.0">

Or if you used it as a Git submodule:

-<Import Project="tools/Lombiq.Analyzers/Lombiq.Analyzers/Build.props" />
+<Import Project="tools/Lombiq.Analyzers/Lombiq.Analyzers.OrchardCore/Build.props" /> 

If you have any other use case, then read on.

Breaking changes

This release upgrades how analyzer configuration is stored. If you've overridden some analyzer configuration, then you'll need to migrate those.

Previously, editor configuration like charset and tab width was in an .editorconfig file, together with some compatible analyzer rule configuration, and the rest of the analyzer rules were configured in RuleSet files. This release moves analyzer configuration to the currently recommended .globalconfig files, while keeping only editor configuration in the .editorconfig file.

Furthermore, to better aid using Lombiq.Analyzers in any .NET project, regardless if it's an Orchard Core app or else, we've split the project into multiple, use case-specific projects/packages.

Upgrading from v3.x.x

Select the Lombiq.Analyzers package suitable for you in any case

Previously, there was only a single Lombiq.Analyzers project/package that contained configuration for general .NET, Orchard Core, Orchard 1 (.NET Framework), and Visual Studio Extension projects. By default, this provided configuration for Orchard Core projects. If you wanted to use it in any other kind of project, you needed to jump through hoops.

Now, there are multiple projects/packages, all specific to a given use case. To get the most suitable configuration for your project, you just need to select the most applicable one. Please check out the updated docs to see how to add the one suitable for you.

If you haven't overridden any analyzer configuration and just used the project as is

Nothing else to do.

If you have overridden analyzer configuration

If you have overridden configuration coming from a RuleSet file:

RuleSets are now deprecated and you need to use .globalconfig files for analyzer configuration instead.

  1. Open the RuleSet file in a text editor, NOT in the Visual Studio GUI editor.
  2. Remove the <Include> element that loads the default RuleSet file from Lombiq.Analyzers so only the overriding rules will be converted.
  3. Follow the official documentation to convert the file into an .editorconfig file. Save the file with the .globalconfig name, NOT .editorconfig.
  4. Put the file into the root of your solution if you want it to be applied to the whole solution. For more involved configuration options, see the updated docs.
If you have overridden configuration coming from the .editorconfig file:

The .editorconfig file now only stores editor-related configuration, like charset and tab settings. All analyzer configuration, also what was formerly in the .editorconfig file, is now in .globalconfig files. Follow the updated docs to override analyzer configuration from .globalconfig files. Overriding editor-related configuration with .editorconfig files works the same as before.

@github-actions github-actions bot changed the title Migrate to .editorconfig from ruleset files OSOE-179: Migrate to .editorconfig from ruleset files Oct 10, 2023
Lombiq.Analyzers/Docs/AddingAnalyzers.md Outdated Show resolved Hide resolved
Lombiq.Analyzers/Docs/AddingAnalyzers.md Outdated Show resolved Hide resolved
@Piedone Piedone merged commit 239fae8 into dev Oct 16, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to .editorconfig from ruleset files (OSOE-179)
2 participants